package com.example.identifyvisio.model.component;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.DecimalFormat;

/*
* 大小
* */

@NoArgsConstructor
@AllArgsConstructor
public class Size {
    private double width;
    private double height;
    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        DecimalFormat df = new DecimalFormat("#.0");
        this.width = Double.parseDouble(df.format (width));
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        DecimalFormat df = new DecimalFormat("#.0");
        this.height = Double.parseDouble(df.format (height));
    }



    public Size(String type){
        switch (type){

//            case "起始" :
//                this.width = 58;
//                this.height = 20;
//                break;
            case "流程" :
            case "判定" :
            case "判断" :
                this.width = 30;
                this.height = 15;
                break;
            case "泳道" :
                this.width = 340;
                this.height = 950;
                break;
            case "水平泳道" :
                this.width = 1020;
                this.height = 950;
                break;
            default:
                this.width = 30;
                this.height = 10;
                break;
        }
    }

    public void setSize(String type){
        switch (type){
            case "流程" :
            case "起始" :
                this.width = 58;
                this.height = 20;
                break;
            case "判定" :
                this.width = 45;
                this.height = 20;
                break;
            case "垂直泳道" :
                this.width = 340;
                this.height = 950;
                break;
            case "水平泳道" :
                this.width = 1020;
                this.height = 950;
                break;
            default:
                break;
        }
    }
}
